package com.ruoyi.project.cms.knowledge.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cms.knowledge.domain.Ptype;
import com.ruoyi.project.cms.knowledge.service.PtypeService;
import com.ruoyi.project.cms.notice.domain.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * 公司:sxt
 * 作者: MR.Z
 * 类名: PtypeController
 * 描述:
 * 时间: 2020-05-19
 */

@Controller
@RequestMapping("/knowledge/ptype")
public class PtypeController extends BaseController {

    private String prefix = "/cms/knowledge";

    @Autowired
    private PtypeService ptypeService;


    @GetMapping("")
    public String ptype() {
        return prefix + "/ptype";
    }

    /*@RequiresPermissions("system:role:list")*/
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Ptype ptype) {
        startPage();
        /*List<Ptype> list = new ArrayList<>();
        list.add(new Ptype(1,"硬装","墙体和天花板.."));*/

        List<Ptype> list = ptypeService.findMore(ptype);


        return getDataTable(list);
    }
}
